package com.ziyun.pop.modules.storeMaterials.dao;

import com.ziyun.pop.modules.storeMaterials.entity.StoreMaterialInDetailEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ziyun.pop.modules.storeMaterials.entity.StoreMaterialInEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * 门店入库明细表
 * 
 * @author guizhao
 * @email 296588519@qq.com
 * @date 2018-10-04 10:03:15
 */
public interface StoreMaterialInDetailDao extends BaseMapper<StoreMaterialInDetailEntity> {

    void saveList(@Param("list") List<StoreMaterialInDetailEntity> list, @Param("storeMaterialInEntity") StoreMaterialInEntity storeMaterialInEntity);

    void saveListByCG(@Param("storeMaterialInDetailEntity1") StoreMaterialInDetailEntity storeMaterialInDetailEntity1, @Param("storeMaterialInEntity") StoreMaterialInEntity storeMaterialInEntity);

    List<StoreMaterialInDetailEntity> getStoreMaterialByinNo(@Param("inNo")String inNo);

    BigDecimal getStoreMaterialQuantityByMaterialId(@Param("materialId")String materialId,@Param("inNo")String inNo);


    @Select(" select * from store_material_in_detail where in_id = #{inId} ")
    List<StoreMaterialInDetailEntity> getInId(@Param("inId") Integer inId);

    @Select(" select * from store_material_in_detail where in_id = #{inIdNew} and in_no = #{inNoNew} ")
    List<StoreMaterialInDetailEntity> getInidAndInNo(@Param("inNoNew") String inNoNew,@Param("inIdNew") Integer inIdNew);

    @Select(" select smid.in_id," +
            "smid.in_no," +
            "smid.material_id," +
            "em.material_name," +
            "smid.material_quantity," +
            "smid.unit_money," +
            "em.show_unit," +
            "em.material_model," +
            "em.specifications," +
            "em.length," +
            "em.width," +
            "em.weight," +
            "smid.total_money from store_material_in_detail smid left join erp_material em on smid.material_id = em.material_id where smid.in_id = ${inId} and smid.in_no = #{inNo}")
    List<StoreMaterialInDetailEntity> getListstorematerialIndetail(@Param("inId") Integer inId,@Param("inNo") String inNo);


}
